﻿using System;
using System.Text;

namespace SharpSqlAnalyzer.nodes
{
	// Token: 0x02000318 RID: 792
	public class TNodeWithAliasClause : TParseTreeNode
	{
		// Token: 0x17000671 RID: 1649
		// (get) Token: 0x06001C2E RID: 7214 RVA: 0x00330951 File Offset: 0x0032EB51
		// (set) Token: 0x06001C2D RID: 7213 RVA: 0x00330948 File Offset: 0x0032EB48
		public virtual TAliasClause AliasClause
		{
			get
			{
				return this.aliasClause;
			}
			set
			{
				this.aliasClause = value;
			}
		}

		// Token: 0x06001C2F RID: 7215 RVA: 0x0033095C File Offset: 0x0032EB5C
		public override string ToString()
		{
			string result;
			if (this.AliasClause == null || (this.AliasClause != null && this.AliasClause.TeradataNamedAlais))
			{
				result = base.ToString();
			}
			else
			{
				TSourceToken startToken = base.startToken;
				if (startToken == null)
				{
					return null;
				}
				TSourceToken tsourceToken;
				if (this.AliasClause.AsToken != null)
				{
					tsourceToken = this.AliasClause.AsToken.container.nextsolidtoken(this.AliasClause.AsToken, -1, false);
				}
				else
				{
					tsourceToken = this.AliasClause.startToken.container.nextsolidtoken(this.AliasClause.startToken, -1, false);
				}
				if (tsourceToken == null)
				{
					return null;
				}
				if (this.GSharpSqlParser == null)
				{
					this.GSharpSqlParser = startToken.GSharpSqlParser;
				}
				TSourceTokenList container = startToken.container;
				if (container == null)
				{
					return null;
				}
				StringBuilder stringBuilder = new StringBuilder("");
				int num = container.indexOf(startToken);
				int num2 = container.indexOf(tsourceToken);
				for (int i = num; i <= num2; i++)
				{
					TSourceToken tsourceToken2 = container.get(i);
					if (this.includingComment || (tsourceToken2.tokencode != 257 && tsourceToken2.tokencode != 258))
					{
						stringBuilder.Append(tsourceToken2.ToString());
					}
				}
				result = stringBuilder.ToString();
			}
			return result;
		}

		// Token: 0x04001A2B RID: 6699
		private TAliasClause aliasClause;
	}
}
